import Oriented from "../../Constants/Oriented";
import INavigate from "../../Interfaces/INavigate";

/**
 * 直线火球
 * created by Five on 2018-11-20 18:37:43
 */
export default class Straight implements INavigate {
    settarget(node: cc.Node) {
    }

    setsize(s: number) {
    }

    setspeed(sp: number) {
        this.speed = sp;
    }
    speed: number; oriented: any;

    setdir(dir: any) {
        this.oriented = dir;
    }
    update(dt: number, node: cc.Node, _: cc.Node) {
        let pos = node.position;
        let speed = this.oriented == Oriented.RIGHT ? this.speed : this.speed * -1;
        pos.addSelf(cc.v2(speed * dt, 0));
        node.position = pos;
    }
}